const char *id;
const char *text;
- id = gtk_buildable_get_name (GTK_BUILDABLE (button));
+ id = gtk_buildable_get_buildable_id (GTK_BUILDABLE (button));
if (strcmp (id, "toolbutton1") == 0)
text = "⌘";
clipboard = gtk_widget_get_clipboard (textview);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
- id = gtk_buildable_get_name (GTK_BUILDABLE (button));
+ id = gtk_buildable_get_buildable_id (GTK_BUILDABLE (button));
if (strcmp (id, "cutbutton") == 0)
gtk_text_buffer_cut_clipboard (buffer, clipboard, TRUE);
const char *id;
gboolean has_text;
- id = gtk_buildable_get_name (GTK_BUILDABLE (button));
+ id = gtk_buildable_get_buildable_id (GTK_BUILDABLE (button));
has_text = gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_TEXT_BUFFER);
if (strcmp (id, "pastebutton") == 0)
const char *id;
gboolean has_selection;
- id = gtk_buildable_get_name (GTK_BUILDABLE (button));
+ id = gtk_buildable_get_buildable_id (GTK_BUILDABLE (button));
has_selection = gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (object));
if (strcmp (id, "cutbutton") == 0 ||
GtkBuildable
GtkBuildableIface
GtkBuildableParser
-gtk_buildable_set_name
-gtk_buildable_get_name
+gtk_buildable_set_buildable_id
+gtk_buildable_get_buildable_id
gtk_buildable_add_child
gtk_buildable_set_buildable_property
gtk_buildable_construct_child
}
/**
- * gtk_buildable_set_name:
+ * gtk_buildable_set_buildable_id:
* @buildable: a #GtkBuildable
- * @name: name to set
+ * @id: name to set
*
- * Sets the name of the @buildable object.
+ * Sets the ID of the @buildable object.
**/
void
-gtk_buildable_set_name (GtkBuildable *buildable,
- const char *name)
+gtk_buildable_set_buildable_id (GtkBuildable *buildable,
+ const char *id)
{
GtkBuildableIface *iface;
g_return_if_fail (GTK_IS_BUILDABLE (buildable));
- g_return_if_fail (name != NULL);
+ g_return_if_fail (id != NULL);
iface = GTK_BUILDABLE_GET_IFACE (buildable);
- if (iface->set_name)
- (* iface->set_name) (buildable, name);
+ if (iface->set_id)
+ (* iface->set_id) (buildable, id);
else
g_object_set_data_full (G_OBJECT (buildable),
- "gtk-builder-name",
- g_strdup (name),
+ "gtk-builder-id",
+ g_strdup (id),
g_free);
}
/**
- * gtk_buildable_get_name:
+ * gtk_buildable_get_buildable_id:
* @buildable: a #GtkBuildable
*
- * Gets the name of the @buildable object.
+ * Gets the ID of the @buildable object.
*
* #GtkBuilder sets the name based on the
* [GtkBuilder UI definition][BUILDER-UI]
* used to construct the @buildable.
*
- * Returns: the name set with gtk_buildable_set_name()
+ * Returns: the ID set with gtk_buildable_set_buildable_id()
**/
const char *
-gtk_buildable_get_name (GtkBuildable *buildable)
+gtk_buildable_get_buildable_id (GtkBuildable *buildable)
{
GtkBuildableIface *iface;
iface = GTK_BUILDABLE_GET_IFACE (buildable);
- if (iface->get_name)
- return (* iface->get_name) (buildable);
+ if (iface->get_id)
+ return (* iface->get_id) (buildable);
else
return (const char *)g_object_get_data (G_OBJECT (buildable),
- "gtk-builder-name");
+ "gtk-builder-id");
}
/**
/**
* GtkBuildableIface:
* @g_iface: the parent class
- * @set_name: Stores the name attribute given in the GtkBuilder UI definition.
+ * @set_id: Stores the id attribute given in the GtkBuilder UI definition.
* #GtkWidget stores the name as object data. Implement this method if your
- * object has some notion of “name” and it makes sense to map the XML name
+ * object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
- * @get_name: The getter corresponding to @set_name. Implement this
- * if you implement @set_name.
+ * @get_id: The getter corresponding to @set_id. Implement this
+ * if you implement @set_id.
* @add_child: Adds a child. The @type parameter can be used to
* differentiate the kind of child. #GtkWidget implements this
* to add event controllers to the widget, #GtkNotebook uses
GTypeInterface g_iface;
/* virtual table */
- void (* set_name) (GtkBuildable *buildable,
- const char *name);
- const char * (* get_name) (GtkBuildable *buildable);
+ void (* set_id) (GtkBuildable *buildable,
+ const char *id);
+ const char * (* get_id) (GtkBuildable *buildable);
void (* add_child) (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
GType gtk_buildable_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
-void gtk_buildable_set_name (GtkBuildable *buildable,
- const char *name);
+void gtk_buildable_set_buildable_id (GtkBuildable *buildable,
+ const char *id);
GDK_AVAILABLE_IN_ALL
-const char * gtk_buildable_get_name (GtkBuildable *buildable);
+const char * gtk_buildable_get_buildable_id (GtkBuildable *buildable);
GDK_AVAILABLE_IN_ALL
void gtk_buildable_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
}
static const char *
-object_get_name (GObject *object)
+object_get_id (GObject *object)
{
if (GTK_IS_BUILDABLE (object))
- return gtk_buildable_get_name (GTK_BUILDABLE (object));
+ return gtk_buildable_get_buildable_id (GTK_BUILDABLE (object));
else
- return g_object_get_data (object, "gtk-builder-name");
+ return g_object_get_data (object, "gtk-builder-id");
}
static GObject *
GTK_NOTE (BUILDER,
g_message ("Trying to get internal child %s from %s",
- childname, object_get_name (info->object)));
+ childname, object_get_id (info->object)));
if (GTK_IS_BUILDABLE (info->object))
obj = gtk_buildable_get_internal_child (GTK_BUILDABLE (info->object),
}
static inline void
-object_set_name (GObject *object,
- const char *name)
+object_set_id (GObject *object,
+ const char *id)
{
if (GTK_IS_BUILDABLE (object))
- gtk_buildable_set_name (GTK_BUILDABLE (object), name);
+ gtk_buildable_set_buildable_id (GTK_BUILDABLE (object), id);
else
- g_object_set_data_full (object, "gtk-builder-name", g_strdup (name), g_free);
+ g_object_set_data_full (object, "gtk-builder-id", g_strdup (id), g_free);
}
void
{
GtkBuilderPrivate *priv = gtk_builder_get_instance_private (builder);
- object_set_name (object, id);
+ object_set_id (object, id);
g_hash_table_insert (priv->objects, g_strdup (id), g_object_ref (object));
}
if (!child_info->parent)
{
- g_warning ("%s: Not adding, No parent", object_get_name (object));
+ g_warning ("%s: Not adding, No parent", object_get_id (object));
return;
}
parent = ((ObjectInfo*)child_info->parent)->object;
GTK_NOTE (BUILDER,
- g_message ("adding %s to %s", object_get_name (object), object_get_name (parent)));
+ g_message ("adding %s to %s", object_get_id (object), object_get_id (parent)));
if (G_IS_LIST_STORE (parent))
{
g_return_if_fail (name && name[0]);
g_return_if_fail (!g_hash_table_contains (priv->objects, name));
- object_set_name (object, name);
+ object_set_id (object, name);
g_hash_table_insert (priv->objects,
g_strdup (name),
g_object_ref (object));
{
g_warning ("Unknown type %s specified in treemodel %s",
(const char *)l->data,
- gtk_buildable_get_name (GTK_BUILDABLE (data->object)));
+ gtk_buildable_get_buildable_id (GTK_BUILDABLE (data->object)));
continue;
}
column_types[i] = type;
{
g_warning ("Unknown type %s specified in treemodel %s",
(const char *)l->data,
- gtk_buildable_get_name (GTK_BUILDABLE (data->object)));
+ gtk_buildable_get_buildable_id (GTK_BUILDABLE (data->object)));
continue;
}
types[i] = type;
static void gtk_widget_accessible_interface_init (GtkAccessibleInterface *iface);
static void gtk_widget_buildable_interface_init (GtkBuildableIface *iface);
-static void gtk_widget_buildable_set_name (GtkBuildable *buildable,
- const char *name);
-static const char * gtk_widget_buildable_get_name (GtkBuildable *buildable);
+static void gtk_widget_buildable_set_id (GtkBuildable *buildable,
+ const char *id);
+static const char * gtk_widget_buildable_get_id (GtkBuildable *buildable);
static GObject * gtk_widget_buildable_get_internal_child (GtkBuildable *buildable,
GtkBuilder *builder,
const char *childname);
/*
* GtkBuildable implementation
*/
-static GQuark quark_builder_set_name = 0;
+static GQuark quark_builder_set_id = 0;
static void
gtk_widget_buildable_add_child (GtkBuildable *buildable,
static void
gtk_widget_buildable_interface_init (GtkBuildableIface *iface)
{
- quark_builder_set_name = g_quark_from_static_string ("gtk-builder-set-name");
+ quark_builder_set_id = g_quark_from_static_string ("gtk-builder-set-id");
- iface->set_name = gtk_widget_buildable_set_name;
- iface->get_name = gtk_widget_buildable_get_name;
+ iface->set_id = gtk_widget_buildable_set_id;
+ iface->get_id = gtk_widget_buildable_get_id;
iface->get_internal_child = gtk_widget_buildable_get_internal_child;
iface->parser_finished = gtk_widget_buildable_parser_finished;
iface->custom_tag_start = gtk_widget_buildable_custom_tag_start;
}
static void
-gtk_widget_buildable_set_name (GtkBuildable *buildable,
- const char *name)
+gtk_widget_buildable_set_id (GtkBuildable *buildable,
+ const char *id)
{
- g_object_set_qdata_full (G_OBJECT (buildable), quark_builder_set_name,
- g_strdup (name), g_free);
+ g_object_set_qdata_full (G_OBJECT (buildable), quark_builder_set_id,
+ g_strdup (id), g_free);
}
static const char *
-gtk_widget_buildable_get_name (GtkBuildable *buildable)
+gtk_widget_buildable_get_id (GtkBuildable *buildable)
{
- return g_object_get_qdata (G_OBJECT (buildable), quark_builder_set_name);
+ return g_object_get_qdata (G_OBJECT (buildable), quark_builder_set_id);
}
static GObject *
if (GTK_IS_BUILDABLE (sl->object))
{
gtk_label_set_text (GTK_LABEL (sl->buildable_id),
- gtk_buildable_get_name (GTK_BUILDABLE (sl->object)));
+ gtk_buildable_get_buildable_id (GTK_BUILDABLE (sl->object)));
}
if (GDK_IS_FRAME_CLOCK (sl->object))
{
const char *id;
- id = gtk_buildable_get_name (GTK_BUILDABLE (object));
+ id = gtk_buildable_get_buildable_id (GTK_BUILDABLE (object));
if (id != NULL && !g_str_has_prefix (id, "___object_"))
return id;
}
#include "gtk-builder-tool.h"
static const char *
-object_get_name (GObject *object)
+object_get_id (GObject *object)
{
if (GTK_IS_BUILDABLE (object))
- return gtk_buildable_get_name (GTK_BUILDABLE (object));
+ return gtk_buildable_get_buildable_id (GTK_BUILDABLE (object));
else
- return g_object_get_data (object, "gtk-builder-name");
+ return g_object_get_data (object, "gtk-builder-id");
}
void
for (l = list; l; l = l->next)
{
object = l->data;
- name = object_get_name (object);
+ name = object_get_id (object);
if (g_str_has_prefix (name, "___") && g_str_has_suffix (name, "___"))
continue;
window = gtk_window_new ();
if (GTK_IS_BUILDABLE (object))
- id = gtk_buildable_get_name (GTK_BUILDABLE (object));
+ id = gtk_buildable_get_buildable_id (GTK_BUILDABLE (object));
set_window_title (GTK_WINDOW (window), filename, id);
g_assert (button != NULL);
g_assert (GTK_IS_BUTTON (button));
g_assert (gtk_widget_get_parent (GTK_WIDGET(button)) != NULL);
- g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (gtk_widget_get_parent (GTK_WIDGET (button)))), "window1") == 0);
+ g_assert (strcmp (gtk_buildable_get_buildable_id (GTK_BUILDABLE (gtk_widget_get_parent (GTK_WIDGET (button)))), "window1") == 0);
gtk_window_destroy (GTK_WINDOW (window));
g_object_unref (builder);
g_assert (vbox != NULL);
g_assert (GTK_IS_BOX (vbox));
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (vbox)) == GTK_ORIENTATION_VERTICAL);
- g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (content_area)), "dialog1-vbox") == 0);
+ g_assert (strcmp (gtk_buildable_get_buildable_id (GTK_BUILDABLE (content_area)), "dialog1-vbox") == 0);
action_area = gtk_builder_get_object (builder, "dialog1-action_area");
g_assert (action_area != NULL);
g_assert (GTK_IS_BOX (action_area));
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (action_area)) == GTK_ORIENTATION_HORIZONTAL);
g_assert (gtk_widget_get_parent (GTK_WIDGET (action_area)) != NULL);
- g_assert (gtk_buildable_get_name (GTK_BUILDABLE (action_area)) != NULL);
+ g_assert (gtk_buildable_get_buildable_id (GTK_BUILDABLE (action_area)) != NULL);
gtk_window_destroy (GTK_WINDOW (dialog));
g_object_unref (builder);
}